home *** CD-ROM | disk | FTP | other *** search
- # simple 'mailmerge' with Master V5.6
- if "$1" = "" {
- beep
- rem Usage: $0 letter
- quit 1
- }
-
- Letter = "$1"
- WORDENTITY = "," ;# words are seperated by commas
-
- # structure of the data file
- # 1. line contains the names of the variables to be substituted
- # all other lines have the respective values at the same position
- open data $Letter.dat
- getline varnames
-
- rem > $Letter.prn
-
- repeat
- # initialisation of the variables for the next letter
- getline values data ;# read values
- vars = "$varnames" ;# variablenames into vars
- foreach var in vars ;# for every variable
- nextitem values $var ;# assign next value
- endfor
-
- # now we read the letter line by line and print it
- open letter $Letter.txt
- repeat
- getline text
- rem $text >> $Letter.prn
- until eof letter
- close letter
-
- # start the next letter on a new page
- rem >> $Letter.prn
- until eof data ;# until we have processed all data
- close data
-